<!DOCTYPE html>
<html lang="zxx">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Home</title>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <!-- Standard -->
    <link rel="shortcut icon" href="assets/img/ficon.png">
    <!-- Google Fonts -->
    <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,500,700' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Quicksand:300,400,700' rel='stylesheet' type='text/css'>
    <!-- Latest Bootstrap min CSS -->
    <link rel="stylesheet" href="assets/css/bootstrap.min.css" type="text/css">
    <!-- latest fonts awesome -->
    <link rel="stylesheet" href="assets/font/css/font-awesome.min.css" type="text/css">
    <!-- Style CSS -->
    <link rel="stylesheet" href="assets/css/style.css" type="text/css">
    <!--  baguetteBox -->
    <link rel="stylesheet" href="assets/css/baguetteBox.css">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v6.2.1/css/all.css" />

</head>

<body>
<!--  nav  -->
<nav id="mainNav" class="navbar navbar-default navbar-fixed-top">
    <div class="container">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#"><img src="assets/img/logo.png" height=55 alt="Logo"/>
            </a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->

        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav navbar-left">
                <li>
                    <a class="page-scroll" href="#home">主页</a>
                </li>
                <li>
                    <a class="page-scroll" href="#about">版本介绍</a>
                </li>
                <li>
                    <a class="page-scroll" href="#team">角色展示</a>
                </li>
                <li>
                    <a class="page-scroll" href="./mycart.html">我的收藏</a>
                </li>
                <li>
                    <a class="page-scroll" href="./user-login.html">用户登录</a>
                </li>
                <li>
                    <a class="page-scroll" href="./new-user.html">注册新用户</a>
                </li>
                <li>
                    <a class="page-scroll" href="./logout">注销</a>
                </li>
                <li>
                    <a class="page-scroll" href="./admin-login.html">管理员登录</a>
                </li>
            </ul>

        </div>
        <!-- navbar-collapse  -->
    </div>
</nav>

<!-- START HEARDER SECTION -->
<header id="home" class="header">
    <div class="container">
        <div class="row">
            <div class="col-sm-12 text-center">
                <div class="header-text">
                    <h1>欢迎来到原神攻略平台</h1>
                    <p>高品质攻略</p>
                    <a href="#welcome" class="page-scroll ank">更多精彩</a>
                </div>
            </div>
        </div>
    </div>
</header>
<!-- START HOME SECTION -->
<section id="welcome" class="section-padding welcome">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="row">
                    <div class="col-md-4">
                        <h2><i class="fa fa-laptop" aria-hidden="true"></i>六入尽明，诸相皆无</h2>
                        <p>3.3新版本上线</p>
                    </div>
                    <div class="col-md-4">
                        <h2><i class="fa fa-rocket" aria-hidden="true"></i>流浪者 & 艾尔海森</h2>
                        <p>新角色登场</p>
                    </div>
                    <div class="col-md-4">
                        <h2><i class="fa fa-camera" aria-hidden="true"></i> 角色细节展示</h2>
                        <p>角色介绍</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<!-- START ABOUT SECTION -->
<section id="about" class="section-padding about">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="row">
                    <div class="col-md-12">
                        <div class="title">
                            <h2>版本 <span>介绍</span></h2>
                        </div>
                        <div class="row">
                            <div class="col-md-6 work">
                                <h2>「六入尽明<span>诸相皆无」</span></h2>
                                <hr>
                                <ul>
                                    <li><i class="fa fa-angle-right" aria-hidden="true"></i>稻妻自古以来就不缺少怪谈传说
                                    </li>
                                    <li><i class="fa fa-angle-right" aria-hidden="true"></i>有些自然与世代传承的鬼怪大妖脱不了干系
                                    </li>
                                    <li><i class="fa fa-angle-right" aria-hidden="true"></i>而有些，也许只是旧时遗事的苍凉一角…
                                    </li>
                                </ul>
                                <br>
                                <a class="btn-wt-bdr2" target="_blank" href="https://ys.mihoyo.com/">Get Started</a>
                            </div>
                            <div class="col-md-6">
                                <img src="assets/img/about.jpg" alt="about">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<!-- START ABOUT BG SECTION -->
<section class="section-padding about-bg">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="row">
                    <div class="col-md-6">
                        <h2>七圣召唤 全新上线</h2>
                        <p>有人说，成为成功牌手的第一步，是收集所有的卡牌！</p>
                        <p>「七圣召唤」卡牌先览活动——「牌手预演」现已开启~</p>

                        <a class="btn-wt-bdr2" target="_blank" href="https://ys.mihoyo.com/">Get Started</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

<!-- START TEAM SECTION -->
<section id="team" class="section-padding team-box">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="title">
                    <h2>NEW <span>ROLE</span></h2>
                    <p>欢迎旅行者们氪金抽取</p>
                </div>
                <div class="container">
                    <div class="row" id="showRole">
<!--                        <div class="col-md-4">-->
<!--                            <div class="team-post">-->
<!--                                <img alt="team" src="assets/img/team/1.jpg">-->
<!--                                <ul class="team-social">-->
<!--                                    <font color="white" size="4">YAOYAO</font>-->
<!--                                </ul>-->
<!--                                <div class="team-content">-->
<!--                                    <h2>瑶瑶</h2>-->
<!--                                </div>-->
<!--                            </div>-->
<!--                        </div>-->
<!--                        <div class="col-md-4">-->
<!--                            <div class="team-post">-->
<!--                                <img alt="team" src="assets/img/team/2.jpg">-->
<!--                                <ul class="team-social">-->
<!--                                    <font color="white" size="4">ALHAITHAM</font>-->
<!--                                </ul>-->
<!--                                <div class="team-content">-->
<!--                                    <h2>艾尔海森</h2>-->
<!--                                </div>-->
<!--                            </div>-->
<!--                        </div>-->
<!--                        <div class="col-md-4">-->
<!--                            <div class="team-post">-->
<!--                                <img alt="team" src="assets/img/team/3.jpg">-->
<!--                                <ul class="team-social">-->
<!--                                    <font color="white" size="4">FARUZAN</font>-->
<!--                                </ul>-->
<!--                                <div class="team-content">-->
<!--                                    <h2>珐露珊</h2>-->
<!--                                </div>-->
<!--                            </div>-->
<!--                        </div>-->

                    </div>
                </div>
            </div>
        </div>
    </div>
</section>


<!-- START FOOTER SECTION -->
<footer class="section-padding footer">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="footer-padding">
                    <div class="row">
                        <div class="col-md-12 text-center">

                            <div class="row">
                                <div class="col-md-12 copyright">
                                    <p>Copyright &copy; 2022.LXY All rights reserved.</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</footer>
<!-- Back to top -->
<a href="#" class="back-to-top" id="back-to-top"> <i class="fa fa-chevron-up" aria-hidden="true"></i>
</a>
<!-- jQuery -->
<script src="assets/js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="assets/js/bootstrap.min.js"></script>

<!-- Plugin JavaScript -->
<script src="assets/js/jquery.easing.min.js"></script>
<!-- baguetteBox -->
<script src="assets/js/baguetteBox.js" async></script>
<script src="assets/js/plugins.js" async></script>
<!--  Custom Theme JavaScript  -->
<script src="assets/js/custom.js"></script>
<!--  Custom Theme filterizr  -->
<script src="assets/js/jquery.filterizr.js"></script>
<script src="assets/js/controls.js"></script>
<!-- Kick off Filterizr -->
<script type="text/javascript">
<!--        $(function() {-->
<!--            //Initialize filterizr with default options-->
<!--            $('.filtr-container').filterizr();-->
<!--        });-->

</script>
<script>
$(document).ready(function(){
    $.getJSON("./listRole", function(roles){
        refreshRoleList(roles);
    });
});

function addToCart(event) {
console.log(event);
  var btn = $(event.target);
<!--  console.log(btn)-->
  var roleId = btn.attr("roleId");
  console.log(roleId);
  $.getJSON("./addToCart?roleId=" + roleId, function(message){
      console.log(message);
      if (message.message == "success") {
        console.log(btn.attr("roleName")+"成功加入收藏！");
        alert(btn.attr("roleName")+"已成功加入收藏！");
      }
  });
}

function refreshRoleList(roles) {
     for (var i = 0; i < roles.length; i++) {
        var role = roles[i];
        console.log(role);
        $("#showRole").append(`
        <div class="col-md-4">
		    <div class="team-post">
			    <img height=300px alt="team" src='./upload/${role.picture}'>
                <ul class="team-social">
                    <font color="white" size="4">${role.ename}</font>
                </ul>
			    <div class="team-content">
                    <h2>${role.cname}</h2>
		        </div>
                <div roleId="${role.id}" roleName="${role.cname}" onclick="addToCart(event)">
                        <i class="fa-regular fa-star" roleId="${role.id}"  roleName="${role.cname}" onclick="addToCart(event)"></i>
                        <font face='黑体' roleId="${role.id}"  roleName="${role.cname}" onclick="addToCart(event)">收藏</font>
                </div>
		    </div>
	    </div>
        `);
     }
}

</script>
</body>
</html>

